﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RCREEE.Library;
using System.Data;

namespace RCREEE.Library.Entities
{
   public class Lookups
    {
        #region private variable

       private int _LanguageCode;
       private string _Name;
       private string _Description;
        private int _ItemId;
        private int _CategoryId;
        private int _ParentItemId;
        private int Roweffect;
           
        #endregion

        #region public properties
        public int LanguageCode
        {
            get { return _LanguageCode; }
            set { _LanguageCode = value; }
        }

        public string Name
        {
            get { return _Name; }
            set { _Name = value; }
        }

        public string Description
        {
            get { return _Description; }
            set { _Description= value; }
        }

        public int ItemId
        {
            get { return _ItemId; }
            set { _ItemId = value; }
        }

        public int CategoryId
        {
            get { return _CategoryId; }
            set { _CategoryId = value; }
        }

        public int ParentItemId
        {
            get { return _ParentItemId; }
            set { _ParentItemId = value; }
        }
        #endregion

        #region Constractor
        public Lookups() { }
        #endregion

        #region private Methods
        
        #endregion

        #region Public Methods
       /// <summary>
        /// calling  DataManager.GetCategories 
       /// </summary>
       /// <returns> list of categories</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetCategories()
        {
            try
            {
                return DataManager.GetCategories();
            }
            catch (Exception) { return null; }
        }
       /// <summary>
        /// calling DataManager.GetListItemsLookUps
       /// </summary>
       /// <param name="LanguageCode"> from session</param>
       /// <param name="CategoryID">from combobox category</param>
       /// <returns>list of item according to categoryId</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetListItemsLookUps(int LanguageCode, int CategoryId)
        {
            try
            {
                return DataManager.GetListItemsLookUps(LanguageCode, CategoryId);
            }
            catch (Exception) { return null; }
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetListItemsEntites(int LanguageCode)
        {
            try
            {
                return DataManager.GetListItemsEntites(LanguageCode);
            }
            catch (Exception) { return null; }
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetContactEntities(int LanguageCode)
        {
            try
            {
                return DataManager.GetContactEntities(LanguageCode);
            }
            catch (Exception) { return null; }
        }
       /// <summary>
        /// calling DataManager.GetItemLookUps
       /// </summary>
       /// <param name="LanguageCode"> from session</param>
        /// <param name="CategoryID"> from combobox category</param>
       /// <param name="ItemId">from comobox ItemId</param>
       /// <returns>Datatable</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public DataTable GetItemsLookUps(int CategoryId,int ItemId)
        {
            try
            {
                return DataManager.GetItemLookUps(CategoryId,ItemId);
            }
            catch (Exception) { return null; }
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public DataTable GetItemProjectGroups(int ItemId)
        {
            try
            {
                return DataManager.GetItemProjectGroups(ItemId);
            }
            catch (Exception) { return null; }
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public DataTable GetProjectTypes(int ItemId,int LanguageCode)
        {
            try
            {
                return DataManager.GetProjectTypes(ItemId,LanguageCode);
            }
            catch (Exception) { return null; }
        }
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetItemProjectTypes(int ParentId,int LanguageCode)
        {
            try
            {
                return DataManager.GetItemProjectTypes(ParentId,LanguageCode);
            }
            catch (Exception) { return null; }
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetItemFeilds(int ParentId, int LanguageCode)
        {
            try
            {
                return DataManager.GetItemFeilds(ParentId, LanguageCode);
            }
            catch (Exception) { return null; }
        }
       /// <summary>
        /// calling DataManager.GetListParentLookUps
       /// </summary>
       /// <param name="LanguageCode">from session </param>
       /// <param name="ParentItemId"> from hidden field current hidden field</param>
       /// <returns>list of parent except me</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public List<TinyItem> GetListParentLookUps(int LanguageCode, int ParentItemId)
        {
            try
            {
                return DataManager.GetListParentLookUps(LanguageCode, ParentItemId);
            }
            catch (Exception) { return null; }
        }
       /// <summary>
        /// calling DataManager.InsertItemLookUps
       /// </summary>
       /// <param name="LookUps"></param>
       /// <returns>bool if true or false </returns>
       // [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
       // public bool InsertItemLookUps(Lookups LookUps)
       // {
       //     try
       //     {
       //         Roweffect = DataManager.InsertItemLookUps(LookUps);
       //         return Roweffect == 1;
       //     }
       //     catch (Exception)
       //     { return Roweffect==0; }
       //}
       /// <summary>
        /// DataManager.UpdateItemLookUps
       /// </summary>
       /// <param name="LookUps"></param>
        /// <returns>bool if true or false</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
        public bool UpdateItemLookUps(List<Lookups> LookUps)
        {
            try
            {
                Roweffect = DataManager.UpdateItemLookUps(LookUps);
                return Roweffect == 1;
            }
            catch (Exception)
            { return Roweffect == 0; }
        }

        public bool UpdateprojectGroups(List<Lookups> LookUps)
        {
            try
            {
                Roweffect = DataManager.UpdateprojectGroups(LookUps);
                return Roweffect == 1;
            }
            catch (Exception)
            { return Roweffect == 0; }
        }
       /// <summary>
       /// DataManager.DeleteItemLookUps
       /// </summary>
       /// <param name="ItemId">from combobox item</param>
       /// <param name="LanguageCode">from session </param>
        /// <returns>bool if true or false</returns>
             [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]
 
        public bool DeleteItemProjectGroup(int ItemId)
        {
            try
            {
                Roweffect = DataManager.DeleteItemprojectGroup(ItemId);
                return Roweffect == 1;
            }
            catch (Exception)
            { return Roweffect == 0; }
        }
        public int InsertItemProjectGroups(List<Lookups> LookUps)
        {
            try
            {
                Roweffect = DataManager.InsertProjectGroups(LookUps);
                return Roweffect;
            }
            catch (Exception)
            { return Roweffect = 0; }
        }


        #endregion

        #region overrides
        public override string ToString()
        {
            return Name;
        }
        #endregion

    }
}
